<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery1.9/jquery-1.9.0.js"></script>
    <script>
         $(function(){
            $("input:eq(0)").click(function(){
                console.log($("div:visible").length);
               $("div:visible").css("background","red");
            });
            $("input:eq(1)").click(function(){
                console.log($("div:hidden").length);
                $("div:hidden").css("background","blue");
            });
            $("input:eq(2)").click(function(){
               /*  :hidden对以下几种有效：
                    1.display为none
                    2.宽高为0
                    3.隐藏域 <input type="hidden">
                    4.祖先元素如果是隐藏的，后代算在的
                    对于visibility:hidden是无效的
 */
                console.log($("body :hidden").length);
                console.log($("body :hidden"));
            });
           
        });
    </script>
</head>
<body>
    <input type="button" value="选择所有可见的div">
    <input type="button" value="选择所有隐藏的div">
    <input type="button" value="选择所有隐藏的元素">
    <div>可见div1</div>
    <div>可见div2</div>
    <div style="display:none;">不可见div</div>
    <div style="width:0px;height: 0px;"></div>
    <input type="hidden">
    <div style="display: none;">
        <div>呵呵</div>
    </div>
    <div style="visibility: hidden;">我是div</div>
</body>
</html>